<?php !defined('INC') && exit('Load failure!'); ?>
{?
$title=$name='站内信';
$userid=$u->info['userid'];
$info=$u->getInfo($u->id);
if(!$u->info['islogin']) kc_tip('<p>请先登录!</p>');
$islook=empty($_GET['islook'])?0:1;
$where='userid='.$userid.' and islook='.$islook;
?}
{#include file='include/top.php'}

<div class="w_960">
	{#include file="block/left.php"}
	
	<div class="w_700 fr mb10">

	<div class="nav mb10">
	<strong>当前位置</strong> | <a title="首页" href="{DIR}">首页</a>  |  <a href="{DIR}?user-info" title="会员中心">会员中心</a>  |  <a href="{DIR}?user-pm" title="{$name}">{$name}</a>
	</div>

		<div class="tab_1_m" id="tab_1_m">
		<h3>{$name}</h3>
		<ul>
			<li class="<?=$islook==0?'now':''?>"><a href="/?user-pm">未读短信</a></li>
			<li class="<?=$islook==1?'now':''?>"><a href="/?user-pm&islook=1">已读短信</a></li>
			<li><a href="javascript:;" class="user_more" onclick="$.kc_ajax({URL:'{DIR}user/pm.php',CMD:'post'})">发短信</a></li>
		</ul>
		</div>
	<div class="f_1 pa10 user_box">
		<form action="" id="infolist">			
			{@res.select table='%s_user_pm' field='puserid,id,content,date' where="{$where}" order='id desc' number="30" cache='0'}
			{#if(empty($res))}
			<div class="user_list">
				<p>暂时没有站内信!</p>
			</div>
			{#else}
			{#foreach($res as $rs)}
			{?$currentU=$u->getInfo($rs['puserid']);?}
			<div class="user_list pm{$rs[id]}">					
				<div class="user_avatar">					
					{#if(!empty($rs['puserid']))}					
					<a href="javascript:;" title="{$currentU[username]}"><img src="{DIR}?user-avatar-{$rs[puserid]}-m" alt="{$currentU[username]}"/><span>{$currentU[username]}</span></a>
					{#else}
					<a href="javascript:;" title="{$currentU[username]}"><span>{$currentU[username]}</span></a>
					{#endif}			
				</div>
				<div class="user_info">				
					<div class="user_title">
						<strong>信息内容</strong>
						<span>{$rs[date] date='Y-m-d H:i'}
						{#if($userid)}					
						<a href="javascript:;" onclick="$.kc_ajax({URL:'{DIR}user/pm.php',CMD:'post','username':'{$currentU[username]}'})">[回复]</a>
						<a href="javascript:;" onclick="$.kc_ajax({URL:'{DIR}user/pm.php',CMD:'delete',id:{$rs[id]}})">[删除]</a>
						<a href="javascript:;" onclick="$.kc_ajax({URL:'{DIR}user/pm.php',CMD:'look',id:{$rs[id]},'islook':{$islook}})">[{#if($islook==1)}待阅{#else}已阅{#endif}]</a>
						{#endif}
						</span>
					</div>	
					<div class="user_list">					
						{$rs[content] code='nl2br'}
					</div>	
				</div>				
			</div>				
			{#endforeach}
			{#endif}
		</form>
	</div>
	
	</div>
	
</div>

{#include file='include/bottom.php'}

</body>
</html>